﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IRRemoteControl
{
    public class DictionaryRawIREncoder
    {
        RawIREncoder encoder;
        List<double> pwlDict = new List<double>();

        public DictionaryRawIREncoder(int carrierWaveFrequency, params double[] pwlDict)
        {
            encoder = new RawIREncoder(carrierWaveFrequency);
            this.pwlDict.AddRange(pwlDict);
        }

        public void SendCommand(params byte[] pwlIndexes)
        {
            List<double> pwls = new List<double>();

            foreach (var pwlIndex in pwlIndexes)
            {
                pwls.Add(pwlDict[pwlIndex]);
            }

            //encoder.SendCommand(pwls.ToArray());

            
            //encoder.conpensationRate += 0.01;
            //Debug.WriteLine(encoder.conpensationRate);
            encoder.SendCommand(pwls.ToArray());
        }
    }
}
